Skip to content

♻️ Refactoring SequenceSet#[] and #ordered_at internals - #774

Merged
nevans merged 3 commits into
masterfrom
sequence_set/slice-refactoring
Oct 10, 2026
Merged

nevans merged 3 commits into
masterfrom
sequence_set/slice-refactoring

Conversation

@nevans

@nevans nevans commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

With the tests from #773, we can be relatively confident these refactorings are safe and don't change any behavior.

@nevans
nevans added this pull request to stack #775 October 3, 2026 00:32
@nevans
nevans force-pushed the sequence_set/slice-refactoring branch from b608d7f to 4bf5bb4 Compare October 3, 2026 13:42
nevans added 3 commits October 9, 2026 23:14
This extracts a private inner API layer for number indexing and does the
input/output conversion in the public API layer.  The private API will
be more convenient to work with internally, since we don't need to worry
about accidentally comparing integers to `:*`.

This comes at the small cost of some duplication.  That duplication is
considered less important here because 1) it's very simple, and 2) the
implementations may drift apart:
* `#at` converts _indexable_ runs into indexable nums,
* `#ordered_at` converts _enumerable_ runs into indexable nums.
Since `set[2**32]` will _always_ be out of bounds, this makes no
difference to the semantics.  And it should have no effect on
performance.

Future performance optimizations can special case when we _know_ we must
be scanning to the end, but that would check for `STAR_INT <= last`.
@nevans
nevans force-pushed the sequence_set/slice-refactoring branch from 4bf5bb4 to a99f698 Compare October 10, 2026 03:15
Base automatically changed from sequence_set/test-coverage to master October 10, 2026 03:25
@nevans
nevans merged commit a99f698 into master Oct 10, 2026
34 checks passed
@nevans
nevans deleted the sequence_set/slice-refactoring branch October 10, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant